<script setup lang="ts">
import { ref } from "vue";
import { onLoad } from "@dcloudio/uni-app";
import { Token } from "@/utils/token";
import { AppData } from "@/utils/app";

onLoad(() => {
  AppData.initConfig((config) => {
    let url = config.security_center;

    // 拼接 cpl
    const cpl = encodeURIComponent(Token.cpl);
    url += `${url.includes("?") ? "&" : "?"}cpl=${cpl}`;
    // 拼接 auth
    url += `&access_token=${encodeURIComponent(Token.auth)}`;

    webUrl.value = url;
  });
});

const webUrl = ref("");
</script>

<template>
  <web-view v-if="webUrl" :src="webUrl" />
</template>
